package com.google.android.material.tabs;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.database.DataSetObserver;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.RippleDrawable;
import android.os.Build.VERSION;
import android.text.Layout;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.BoolRes;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.Dimension;
import androidx.annotation.DrawableRes;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.core.view.ViewCompat;
import androidx.core.widget.TextViewCompat;
import androidx.viewpager.widget.ViewPager;
import androidx.viewpager.widget.ViewPager.DecorView;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Iterator;
import o.ah.g;
import o.aqu.n;
import o.aqv;
import o.ar;
import o.asa;
import o.ash;
import o.asi;
import o.asl;
import o.asw;
import o.cz;
import o.gg;
import o.hi;
import o.hz;
import o.PagerAdapter;

@DecorView
public class TabLayout extends HorizontalScrollView {
    private static final o.hg.e<b> ʼॱ = new o.hg.b(16);
    ColorStateList ʻ;
    int ʻॱ;
    ColorStateList ʼ;
    @Nullable
    Drawable ʽ;
    private b ʽॱ;
    private final ArrayList<b> ʾ;
    boolean ʿ;
    ViewPager ˈ;
    private final e ˉ;
    int ˊ;
    private final int ˊˊ;
    private final RectF ˊˋ;
    float ˊॱ;
    private final int ˊᐝ;
    int ˋ;
    private final int ˋˊ;
    private c ˋˋ;
    float ˋॱ;
    private ValueAnimator ˋᐝ;
    private int ˌ;
    private final ArrayList<c> ˍ;
    int ˎ;
    private c ˎˎ;
    private a ˎˏ;
    int ˏ;
    private f ˏˎ;
    private PagerAdapter ˏˏ;
    int ˏॱ;
    private boolean ˑ;
    final int ͺ;
    private DataSetObserver ͺॱ;
    int ॱ;
    private final o.hg.e<i> ॱʼ;
    int ॱˊ;
    boolean ॱˋ;
    int ॱˎ;
    ColorStateList ॱॱ;
    boolean ॱᐝ;
    android.graphics.PorterDuff.Mode ᐝ;
    int ᐝॱ;

    @RestrictTo({androidx.annotation.RestrictTo.d.LIBRARY_GROUP})
    @Retention(RetentionPolicy.SOURCE)
    public @interface Mode {
    }

    @RestrictTo({androidx.annotation.RestrictTo.d.LIBRARY_GROUP})
    @Retention(RetentionPolicy.SOURCE)
    public @interface TabGravity {
    }

    @RestrictTo({androidx.annotation.RestrictTo.d.LIBRARY_GROUP})
    @Retention(RetentionPolicy.SOURCE)
    public @interface TabIndicatorGravity {
    }

    class a implements androidx.viewpager.widget.ViewPager.d {
        final /* synthetic */ TabLayout ˋ;
        private boolean ˎ;

        a(TabLayout tabLayout) {
            this.ˋ = tabLayout;
        }

        public void onAdapterChanged(@NonNull ViewPager viewPager, @Nullable PagerAdapter ozVar, @Nullable PagerAdapter ozVar2) {
            if (this.ˋ.ˈ == viewPager) {
                this.ˋ.ˎ(ozVar2, this.ˎ);
            }
        }

        void ॱ(boolean z) {
            this.ˎ = z;
        }
    }

    public static class b {
        private int ʻ = -1;
        public i ˊ;
        private Object ˋ;
        private CharSequence ˎ;
        public TabLayout ˏ;
        private Drawable ॱ;
        private CharSequence ॱॱ;
        private View ᐝ;

        @Nullable
        public View ˎ() {
            return this.ᐝ;
        }

        @NonNull
        public b ˏ(@Nullable View view) {
            this.ᐝ = view;
            ʽ();
            return this;
        }

        @NonNull
        public b ॱ(@LayoutRes int i) {
            return ˏ(LayoutInflater.from(this.ˊ.getContext()).inflate(i, this.ˊ, false));
        }

        @Nullable
        public Drawable ˋ() {
            return this.ॱ;
        }

        public int ॱ() {
            return this.ʻ;
        }

        void ˋ(int i) {
            this.ʻ = i;
        }

        @Nullable
        public CharSequence ˊ() {
            return this.ˎ;
        }

        @NonNull
        public b ˎ(@Nullable Drawable drawable) {
            this.ॱ = drawable;
            ʽ();
            return this;
        }

        @NonNull
        public b ˎ(@Nullable CharSequence charSequence) {
            if (TextUtils.isEmpty(this.ॱॱ) && !TextUtils.isEmpty(charSequence)) {
                this.ˊ.setContentDescription(charSequence);
            }
            this.ˎ = charSequence;
            ʽ();
            return this;
        }

        public void ˏ() {
            if (this.ˏ == null) {
                throw new IllegalArgumentException("Tab not attached to a TabLayout");
            }
            this.ˏ.ˎ(this);
        }

        public boolean ʻ() {
            if (this.ˏ != null) {
                return this.ˏ.ˊ() == this.ʻ;
            } else {
                throw new IllegalArgumentException("Tab not attached to a TabLayout");
            }
        }

        @NonNull
        public b ˊ(@Nullable CharSequence charSequence) {
            this.ॱॱ = charSequence;
            ʽ();
            return this;
        }

        void ʽ() {
            if (this.ˊ != null) {
                this.ˊ.ˏ();
            }
        }

        void ᐝ() {
            this.ˏ = null;
            this.ˊ = null;
            this.ˋ = null;
            this.ॱ = null;
            this.ˎ = null;
            this.ॱॱ = null;
            this.ʻ = -1;
            this.ᐝ = null;
        }
    }

    public interface c<T extends b> {
        void ˊ(T t);

        void ˎ(T t);

        void ˏ(T t);
    }

    class d extends DataSetObserver {
        final /* synthetic */ TabLayout ˏ;

        d(TabLayout tabLayout) {
            this.ˏ = tabLayout;
        }

        public void onChanged() {
            this.ˏ.ʽ();
        }

        public void onInvalidated() {
            this.ˏ.ʽ();
        }
    }

    class e extends LinearLayout {
        private int ʻ = -1;
        private final GradientDrawable ʼ;
        private ValueAnimator ʽ;
        final /* synthetic */ TabLayout ˊ;
        float ˋ;
        private final Paint ˎ;
        int ˏ = -1;
        private int ॱ;
        private int ॱॱ = -1;
        private int ᐝ = -1;

        e(TabLayout tabLayout, Context context) {
            this.ˊ = tabLayout;
            super(context);
            setWillNotDraw(false);
            this.ˎ = new Paint();
            this.ʼ = new GradientDrawable();
        }

        void ˊ(int i) {
            if (this.ˎ.getColor() != i) {
                this.ˎ.setColor(i);
                ViewCompat.ˎ(this);
            }
        }

        void ˎ(int i) {
            if (this.ॱ != i) {
                this.ॱ = i;
                ViewCompat.ˎ(this);
            }
        }

        boolean ˏ() {
            int childCount = getChildCount();
            for (int i = 0; i < childCount; i++) {
                if (getChildAt(i).getWidth() <= 0) {
                    return true;
                }
            }
            return false;
        }

        void ˏ(int i, float f) {
            if (this.ʽ != null && this.ʽ.isRunning()) {
                this.ʽ.cancel();
            }
            this.ˏ = i;
            this.ˋ = f;
            ॱ();
        }

        public void onRtlPropertiesChanged(int i) {
            super.onRtlPropertiesChanged(i);
            if (VERSION.SDK_INT < 23 && this.ʻ != i) {
                requestLayout();
                this.ʻ = i;
            }
        }

        protected void onMeasure(int i, int i2) {
            boolean z = false;
            super.onMeasure(i, i2);
            if (MeasureSpec.getMode(i) == 1073741824 && this.ˊ.ॱˎ == 1 && this.ˊ.ˏॱ == 1) {
                int childCount = getChildCount();
                int i3 = 0;
                int i4 = 0;
                while (i3 < childCount) {
                    int max;
                    View childAt = getChildAt(i3);
                    if (childAt.getVisibility() == 0) {
                        max = Math.max(i4, childAt.getMeasuredWidth());
                    } else {
                        max = i4;
                    }
                    i3++;
                    i4 = max;
                }
                if (i4 > 0) {
                    if (i4 * childCount <= getMeasuredWidth() - (this.ˊ.ˏ(16) * 2)) {
                        i3 = 0;
                        while (i3 < childCount) {
                            boolean z2;
                            LayoutParams layoutParams = (LayoutParams) getChildAt(i3).getLayoutParams();
                            if (layoutParams.width == i4 && layoutParams.weight == 0.0f) {
                                z2 = z;
                            } else {
                                layoutParams.width = i4;
                                layoutParams.weight = 0.0f;
                                z2 = true;
                            }
                            i3++;
                            z = z2;
                        }
                    } else {
                        this.ˊ.ˏॱ = 0;
                        this.ˊ.ˏ(false);
                        z = true;
                    }
                    if (z) {
                        super.onMeasure(i, i2);
                    }
                }
            }
        }

        protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
            super.onLayout(z, i, i2, i3, i4);
            if (this.ʽ == null || !this.ʽ.isRunning()) {
                ॱ();
                return;
            }
            this.ʽ.cancel();
            ॱ(this.ˏ, Math.round(((float) this.ʽ.getDuration()) * (1.0f - this.ʽ.getAnimatedFraction())));
        }

        private void ॱ() {
            int i;
            int i2;
            View childAt = getChildAt(this.ˏ);
            if (childAt == null || childAt.getWidth() <= 0) {
                i = -1;
                i2 = -1;
            } else {
                i2 = childAt.getLeft();
                i = childAt.getRight();
                if (!this.ˊ.ॱᐝ && (childAt instanceof i)) {
                    ˏ((i) childAt, this.ˊ.ˊˋ);
                    i2 = (int) this.ˊ.ˊˋ.left;
                    i = (int) this.ˊ.ˊˋ.right;
                }
                if (this.ˋ > 0.0f && this.ˏ < getChildCount() - 1) {
                    int i3;
                    childAt = getChildAt(this.ˏ + 1);
                    int left = childAt.getLeft();
                    int right = childAt.getRight();
                    if (this.ˊ.ॱᐝ || !(childAt instanceof i)) {
                        i3 = right;
                        right = left;
                    } else {
                        ˏ((i) childAt, this.ˊ.ˊˋ);
                        right = (int) this.ˊ.ˊˋ.left;
                        i3 = (int) this.ˊ.ˊˋ.right;
                    }
                    i2 = (int) ((((float) i2) * (1.0f - this.ˋ)) + (((float) right) * this.ˋ));
                    i = (int) ((((float) i3) * this.ˋ) + (((float) i) * (1.0f - this.ˋ)));
                }
            }
            ˏ(i2, i);
        }

        void ˏ(int i, int i2) {
            if (i != this.ॱॱ || i2 != this.ᐝ) {
                this.ॱॱ = i;
                this.ᐝ = i2;
                ViewCompat.ˎ(this);
            }
        }

        void ॱ(final int i, int i2) {
            if (this.ʽ != null && this.ʽ.isRunning()) {
                this.ʽ.cancel();
            }
            View childAt = getChildAt(i);
            if (childAt == null) {
                ॱ();
                return;
            }
            int left = childAt.getLeft();
            int right = childAt.getRight();
            if (!this.ˊ.ॱᐝ && (childAt instanceof i)) {
                ˏ((i) childAt, this.ˊ.ˊˋ);
                left = (int) this.ˊ.ˊˋ.left;
                right = (int) this.ˊ.ˊˋ.right;
            }
            final int i3 = this.ॱॱ;
            final int i4 = this.ᐝ;
            if (i3 != left || i4 != right) {
                ValueAnimator valueAnimator = new ValueAnimator();
                this.ʽ = valueAnimator;
                valueAnimator.setInterpolator(aqv.ॱ);
                valueAnimator.setDuration((long) i2);
                valueAnimator.setFloatValues(new float[]{0.0f, 1.0f});
                valueAnimator.addUpdateListener(new AnimatorUpdateListener(this) {
                    final /* synthetic */ e ˋ;

                    public void onAnimationUpdate(ValueAnimator valueAnimator) {
                        float animatedFraction = valueAnimator.getAnimatedFraction();
                        this.ˋ.ˏ(aqv.ˊ(i3, left, animatedFraction), aqv.ˊ(i4, right, animatedFraction));
                    }
                });
                valueAnimator.addListener(new AnimatorListenerAdapter(this) {
                    final /* synthetic */ e ˋ;

                    public void onAnimationEnd(Animator animator) {
                        this.ˋ.ˏ = i;
                        this.ˋ.ˋ = 0.0f;
                    }
                });
                valueAnimator.start();
            }
        }

        private void ˏ(i iVar, RectF rectF) {
            int ˎ = iVar.ˋ();
            if (ˎ < this.ˊ.ˏ(24)) {
                ˎ = this.ˊ.ˏ(24);
            }
            int left = (iVar.getLeft() + iVar.getRight()) / 2;
            rectF.set((float) (left - (ˎ / 2)), 0.0f, (float) ((ˎ / 2) + left), 0.0f);
        }

        public void draw(Canvas canvas) {
            int intrinsicHeight;
            int i = 0;
            if (this.ˊ.ʽ != null) {
                intrinsicHeight = this.ˊ.ʽ.getIntrinsicHeight();
            } else {
                intrinsicHeight = 0;
            }
            if (this.ॱ >= 0) {
                intrinsicHeight = this.ॱ;
            }
            switch (this.ˊ.ʻॱ) {
                case 0:
                    i = getHeight() - intrinsicHeight;
                    intrinsicHeight = getHeight();
                    break;
                case 1:
                    i = (getHeight() - intrinsicHeight) / 2;
                    intrinsicHeight = (intrinsicHeight + getHeight()) / 2;
                    break;
                case 2:
                    break;
                case 3:
                    intrinsicHeight = getHeight();
                    break;
                default:
                    intrinsicHeight = 0;
                    break;
            }
            if (this.ॱॱ >= 0 && this.ᐝ > this.ॱॱ) {
                Drawable ʻ = gg.ʻ(this.ˊ.ʽ != null ? this.ˊ.ʽ : this.ʼ);
                ʻ.setBounds(this.ॱॱ, i, this.ᐝ, intrinsicHeight);
                if (this.ˎ != null) {
                    if (VERSION.SDK_INT == 21) {
                        ʻ.setColorFilter(this.ˎ.getColor(), android.graphics.PorterDuff.Mode.SRC_IN);
                    } else {
                        gg.ॱ(ʻ, this.ˎ.getColor());
                    }
                }
                ʻ.draw(canvas);
            }
            super.draw(canvas);
        }
    }

    public static class f implements ViewPager.OnPageChangeListener {
        private int ˎ;
        private final WeakReference<TabLayout> ˏ;
        private int ॱ;

        public f(TabLayout tabLayout) {
            this.ˏ = new WeakReference(tabLayout);
        }

        public void onPageScrolled(int i) {
            this.ˎ = this.ॱ;
            this.ॱ = i;
        }

        public void onPageScrolled(int i, float f, int i2) {
            boolean z = false;
            TabLayout tabLayout = (TabLayout) this.ˏ.get();
            if (tabLayout != null) {
                boolean z2 = this.ॱ != 2 || this.ˎ == 1;
                if (!(this.ॱ == 2 && this.ˎ == 0)) {
                    z = true;
                }
                tabLayout.ˊ(i, f, z2, z);
            }
        }

        public void onPageScrollStateChanged(int i) {
            TabLayout tabLayout = (TabLayout) this.ˏ.get();
            if (tabLayout != null && tabLayout.ˊ() != i && i < tabLayout.ॱ()) {
                boolean z = this.ॱ == 0 || (this.ॱ == 2 && this.ˎ == 0);
                tabLayout.ˎ(tabLayout.ॱ(i), z);
            }
        }

        void ˏ() {
            this.ॱ = 0;
            this.ˎ = 0;
        }
    }

    class i extends LinearLayout {
        @Nullable
        private Drawable ʻ;
        private TextView ʼ;
        private ImageView ʽ;
        private TextView ˊ;
        private View ˋ;
        final /* synthetic */ TabLayout ˎ;
        private ImageView ˏ;
        private b ॱ;
        private int ॱॱ = 2;

        public i(TabLayout tabLayout, Context context) {
            int i;
            this.ˎ = tabLayout;
            super(context);
            ˊ(context);
            ViewCompat.ˏ(this, tabLayout.ˊ, tabLayout.ˋ, tabLayout.ॱ, tabLayout.ˏ);
            setGravity(17);
            if (tabLayout.ॱˋ) {
                i = 0;
            } else {
                i = 1;
            }
            setOrientation(i);
            setClickable(true);
            ViewCompat.ˋ(this, hz.ॱ(getContext(), 1002));
        }

        private void ˊ(Context context) {
            Drawable gradientDrawable;
            Drawable drawable = null;
            if (this.ˎ.ͺ != 0) {
                this.ʻ = ar.ˋ(context, this.ˎ.ͺ);
                if (this.ʻ != null && this.ʻ.isStateful()) {
                    this.ʻ.setState(getDrawableState());
                }
            } else {
                this.ʻ = null;
            }
            Drawable gradientDrawable2 = new GradientDrawable();
            ((GradientDrawable) gradientDrawable2).setColor(0);
            if (this.ˎ.ʻ != null) {
                gradientDrawable = new GradientDrawable();
                gradientDrawable.setCornerRadius(1.0E-5f);
                gradientDrawable.setColor(-1);
                ColorStateList ˎ = asl.ˎ(this.ˎ.ʻ);
                if (VERSION.SDK_INT >= 21) {
                    if (this.ˎ.ʿ) {
                        gradientDrawable2 = null;
                    }
                    if (!this.ˎ.ʿ) {
                        drawable = gradientDrawable;
                    }
                    gradientDrawable = new RippleDrawable(ˎ, gradientDrawable2, drawable);
                } else {
                    gg.ॱ(gg.ʻ(gradientDrawable), ˎ);
                    gradientDrawable = new LayerDrawable(new Drawable[]{gradientDrawable2, drawable});
                }
            } else {
                gradientDrawable = gradientDrawable2;
            }
            ViewCompat.ˏ(this, gradientDrawable);
            this.ˎ.invalidate();
        }

        private void ˋ(Canvas canvas) {
            if (this.ʻ != null) {
                this.ʻ.setBounds(getLeft(), getTop(), getRight(), getBottom());
                this.ʻ.draw(canvas);
            }
        }

        protected void drawableStateChanged() {
            super.drawableStateChanged();
            int i = 0;
            int[] drawableState = getDrawableState();
            if (this.ʻ != null && this.ʻ.isStateful()) {
                i = 0 | this.ʻ.setState(drawableState);
            }
            if (i != 0) {
                invalidate();
                this.ˎ.invalidate();
            }
        }

        public boolean performClick() {
            boolean performClick = super.performClick();
            if (this.ॱ == null) {
                return performClick;
            }
            if (!performClick) {
                playSoundEffect(0);
            }
            this.ॱ.ˏ();
            return true;
        }

        public void setSelected(boolean z) {
            Object obj = isSelected() != z ? 1 : null;
            super.setSelected(z);
            if (obj != null && z && VERSION.SDK_INT < 16) {
                sendAccessibilityEvent(4);
            }
            if (this.ˊ != null) {
                this.ˊ.setSelected(z);
            }
            if (this.ˏ != null) {
                this.ˏ.setSelected(z);
            }
            if (this.ˋ != null) {
                this.ˋ.setSelected(z);
            }
        }

        public void onInitializeAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
            super.onInitializeAccessibilityEvent(accessibilityEvent);
            accessibilityEvent.setClassName(androidx.appcompat.app.ActionBar.e.class.getName());
        }

        @TargetApi(14)
        public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
            super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
            accessibilityNodeInfo.setClassName(androidx.appcompat.app.ActionBar.e.class.getName());
        }

        public void onMeasure(int i, int i2) {
            int i3 = 1;
            int size = MeasureSpec.getSize(i);
            int mode = MeasureSpec.getMode(i);
            int ᐝ = this.ˎ.ᐝ();
            if (ᐝ > 0 && (mode == 0 || size > ᐝ)) {
                i = MeasureSpec.makeMeasureSpec(this.ˎ.ॱˊ, Integer.MIN_VALUE);
            }
            super.onMeasure(i, i2);
            if (this.ˊ != null) {
                float f = this.ˎ.ˊॱ;
                size = this.ॱॱ;
                if (this.ˏ != null && this.ˏ.getVisibility() == 0) {
                    size = 1;
                } else if (this.ˊ != null && this.ˊ.getLineCount() > 1) {
                    f = this.ˎ.ˋॱ;
                }
                float textSize = this.ˊ.getTextSize();
                int lineCount = this.ˊ.getLineCount();
                int ˊ = TextViewCompat.ˊ(this.ˊ);
                if (f != textSize || (ˊ >= 0 && size != ˊ)) {
                    if (this.ˎ.ॱˎ == 1 && f > textSize && lineCount == 1) {
                        Layout layout = this.ˊ.getLayout();
                        if (layout == null || ˎ(layout, 0, f) > ((float) ((getMeasuredWidth() - getPaddingLeft()) - getPaddingRight()))) {
                            i3 = 0;
                        }
                    }
                    if (i3 != 0) {
                        this.ˊ.setTextSize(0, f);
                        this.ˊ.setMaxLines(size);
                        super.onMeasure(i, i2);
                    }
                }
            }
        }

        void ˎ(@Nullable b bVar) {
            if (bVar != this.ॱ) {
                this.ॱ = bVar;
                ˏ();
            }
        }

        void ॱ() {
            ˎ(null);
            setSelected(false);
        }

        final void ˏ() {
            boolean z;
            b bVar = this.ॱ;
            View ˎ = bVar != null ? bVar.ˎ() : null;
            if (ˎ != null) {
                i parent = ˎ.getParent();
                if (parent != this) {
                    if (parent != null) {
                        parent.removeView(ˎ);
                    }
                    addView(ˎ);
                }
                this.ˋ = ˎ;
                if (this.ˊ != null) {
                    this.ˊ.setVisibility(8);
                }
                if (this.ˏ != null) {
                    this.ˏ.setVisibility(8);
                    this.ˏ.setImageDrawable(null);
                }
                this.ʼ = (TextView) ˎ.findViewById(16908308);
                if (this.ʼ != null) {
                    this.ॱॱ = TextViewCompat.ˊ(this.ʼ);
                }
                this.ʽ = (ImageView) ˎ.findViewById(16908294);
            } else {
                if (this.ˋ != null) {
                    removeView(this.ˋ);
                    this.ˋ = null;
                }
                this.ʼ = null;
                this.ʽ = null;
            }
            if (this.ˋ == null) {
                if (this.ˏ == null) {
                    ImageView imageView = (ImageView) LayoutInflater.from(getContext()).inflate(o.aqu.i.ˊ, this, false);
                    addView(imageView, 0);
                    this.ˏ = imageView;
                }
                Drawable mutate = (bVar == null || bVar.ˋ() == null) ? null : gg.ʻ(bVar.ˋ()).mutate();
                if (mutate != null) {
                    gg.ॱ(mutate, this.ˎ.ʼ);
                    if (this.ˎ.ᐝ != null) {
                        gg.ˋ(mutate, this.ˎ.ᐝ);
                    }
                }
                if (this.ˊ == null) {
                    TextView textView = (TextView) LayoutInflater.from(getContext()).inflate(o.aqu.i.ˎ, this, false);
                    addView(textView);
                    this.ˊ = textView;
                    this.ॱॱ = TextViewCompat.ˊ(this.ˊ);
                }
                TextViewCompat.ˎ(this.ˊ, this.ˎ.ˎ);
                if (this.ˎ.ॱॱ != null) {
                    this.ˊ.setTextColor(this.ˎ.ॱॱ);
                }
                ˋ(this.ˊ, this.ˏ);
            } else if (!(this.ʼ == null && this.ʽ == null)) {
                ˋ(this.ʼ, this.ʽ);
            }
            if (!(bVar == null || TextUtils.isEmpty(bVar.ॱॱ))) {
                setContentDescription(bVar.ॱॱ);
            }
            if (bVar == null || !bVar.ʻ()) {
                z = false;
            } else {
                z = true;
            }
            setSelected(z);
        }

        final void ˎ() {
            setOrientation(this.ˎ.ॱˋ ? 0 : 1);
            if (this.ʼ == null && this.ʽ == null) {
                ˋ(this.ˊ, this.ˏ);
            } else {
                ˋ(this.ʼ, this.ʽ);
            }
        }

        private void ˋ(@Nullable TextView textView, @Nullable ImageView imageView) {
            CharSequence ˊ;
            int i;
            CharSequence ˊ2;
            CharSequence charSequence = null;
            Drawable mutate = (this.ॱ == null || this.ॱ.ˋ() == null) ? null : gg.ʻ(this.ॱ.ˋ()).mutate();
            if (this.ॱ != null) {
                ˊ = this.ॱ.ˊ();
            } else {
                ˊ = null;
            }
            if (imageView != null) {
                if (mutate != null) {
                    imageView.setImageDrawable(mutate);
                    imageView.setVisibility(0);
                    setVisibility(0);
                } else {
                    imageView.setVisibility(8);
                    imageView.setImageDrawable(null);
                }
            }
            if (TextUtils.isEmpty(ˊ)) {
                i = 0;
            } else {
                i = 1;
            }
            if (textView != null) {
                if (i != 0) {
                    textView.setText(ˊ);
                    textView.setVisibility(0);
                    setVisibility(0);
                } else {
                    textView.setVisibility(8);
                    textView.setText(null);
                }
            }
            if (imageView != null) {
                int i2;
                MarginLayoutParams marginLayoutParams = (MarginLayoutParams) imageView.getLayoutParams();
                if (i == 0 || imageView.getVisibility() != 0) {
                    i2 = 0;
                } else {
                    i2 = this.ˎ.ˏ(8);
                }
                if (this.ˎ.ॱˋ) {
                    if (i2 != hi.ॱ(marginLayoutParams)) {
                        hi.ˏ(marginLayoutParams, i2);
                        marginLayoutParams.bottomMargin = 0;
                        imageView.setLayoutParams(marginLayoutParams);
                        imageView.requestLayout();
                    }
                } else if (i2 != marginLayoutParams.bottomMargin) {
                    marginLayoutParams.bottomMargin = i2;
                    hi.ˏ(marginLayoutParams, 0);
                    imageView.setLayoutParams(marginLayoutParams);
                    imageView.requestLayout();
                }
            }
            if (this.ॱ != null) {
                ˊ2 = this.ॱ.ॱॱ;
            } else {
                ˊ2 = null;
            }
            if (i == 0) {
                charSequence = ˊ2;
            }
            cz.ˋ(this, charSequence);
        }

        private int ˋ() {
            int i = 0;
            int i2 = 0;
            int i3 = 0;
            for (View view : new View[]{this.ˊ, this.ˏ, this.ˋ}) {
                if (view != null && view.getVisibility() == 0) {
                    i2 = i3 != 0 ? Math.min(i2, view.getLeft()) : view.getLeft();
                    i = i3 != 0 ? Math.max(i, view.getRight()) : view.getRight();
                    i3 = 1;
                }
            }
            return i - i2;
        }

        private float ˎ(Layout layout, int i, float f) {
            return layout.getLineWidth(i) * (f / layout.getPaint().getTextSize());
        }
    }

    public static class j implements asw {
        private final ViewPager ˏ;

        public j(ViewPager viewPager) {
            this.ˏ = viewPager;
        }

        public void ˊ(b bVar) {
            this.ˏ.setCurrentItem(bVar.ॱ());
        }

        public void ˎ(b bVar) {
        }

        public void ˏ(b bVar) {
        }
    }

    public TabLayout(Context context) {
        this(context, null);
    }

    public TabLayout(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, o.aqu.d.ʻॱ);
    }

    public TabLayout(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.ʾ = new ArrayList();
        this.ˊˋ = new RectF();
        this.ॱˊ = ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED;
        this.ˍ = new ArrayList();
        this.ॱʼ = new o.hg.c(12);
        setHorizontalScrollBarEnabled(false);
        this.ˉ = new e(this, context);
        super.addView(this.ˉ, 0, new FrameLayout.LayoutParams(-2, -1));
        TypedArray ॱ = asa.ॱ(context, attributeSet, n.ˏꜟ, i, o.aqu.f.ˏॱ, n.ـˎ);
        this.ˉ.ˎ(ॱ.getDimensionPixelSize(n.ˏﹳ, -1));
        this.ˉ.ˊ(ॱ.getColor(n.ˑˋ, 0));
        setSelectedTabIndicator(asi.ˎ(context, ॱ, n.ͺͺ));
        setSelectedTabIndicatorGravity(ॱ.getInt(n.ˡ, 0));
        setTabIndicatorFullWidth(ॱ.getBoolean(n.ˮ, true));
        int dimensionPixelSize = ॱ.getDimensionPixelSize(n.ॱٴ, 0);
        this.ˏ = dimensionPixelSize;
        this.ॱ = dimensionPixelSize;
        this.ˋ = dimensionPixelSize;
        this.ˊ = dimensionPixelSize;
        this.ˊ = ॱ.getDimensionPixelSize(n.ߵॱ, this.ˊ);
        this.ˋ = ॱ.getDimensionPixelSize(n.ߺॱ, this.ˋ);
        this.ॱ = ॱ.getDimensionPixelSize(n.ߴॱ, this.ॱ);
        this.ˏ = ॱ.getDimensionPixelSize(n.ॱߴ, this.ˏ);
        this.ˎ = ॱ.getResourceId(n.ـˎ, o.aqu.f.ˋ);
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(this.ˎ, g.ۥ);
        try {
            this.ˊॱ = (float) obtainStyledAttributes.getDimensionPixelSize(g.ॱʹ, 0);
            this.ॱॱ = asi.ˊ(context, obtainStyledAttributes, g.ॱߴ);
            if (ॱ.hasValue(n.ۥ)) {
                this.ॱॱ = asi.ˊ(context, ॱ, n.ۥ);
            }
            if (ॱ.hasValue(n.ٴॱ)) {
                this.ॱॱ = ˊ(this.ॱॱ.getDefaultColor(), ॱ.getColor(n.ٴॱ, 0));
            }
            this.ʼ = asi.ˊ(context, ॱ, n.ॱי);
            this.ᐝ = ash.ˏ(ॱ.getInt(n.ॱՙ, -1), null);
            this.ʻ = asi.ˊ(context, ॱ, n.ॱʹ);
            this.ᐝॱ = ॱ.getInt(n.ˑᐝ, 300);
            this.ˊᐝ = ॱ.getDimensionPixelSize(n.ـᐝ, -1);
            this.ˋˊ = ॱ.getDimensionPixelSize(n.ՙॱ, -1);
            this.ͺ = ॱ.getResourceId(n.ˏꓸ, 0);
            this.ˌ = ॱ.getDimensionPixelSize(n.ˑˊ, 0);
            this.ॱˎ = ॱ.getInt(n.ˬ, 1);
            this.ˏॱ = ॱ.getInt(n.ـˏ, 0);
            this.ॱˋ = ॱ.getBoolean(n.יॱ, false);
            this.ʿ = ॱ.getBoolean(n.ॱᵎ, false);
            ॱ.recycle();
            Resources resources = getResources();
            this.ˋॱ = (float) resources.getDimensionPixelSize(o.aqu.c.ᐝॱ);
            this.ˊˊ = resources.getDimensionPixelSize(o.aqu.c.ॱˎ);
            ॱˊ();
        } finally {
            obtainStyledAttributes.recycle();
        }
    }

    public void setSelectedTabIndicatorColor(@ColorInt int i) {
        this.ˉ.ˊ(i);
    }

    @Deprecated
    public void setSelectedTabIndicatorHeight(int i) {
        this.ˉ.ˎ(i);
    }

    public void setScrollPosition(int i, float f, boolean z) {
        ˊ(i, f, z, true);
    }

    void ˊ(int i, float f, boolean z, boolean z2) {
        int round = Math.round(((float) i) + f);
        if (round >= 0 && round < this.ˉ.getChildCount()) {
            if (z2) {
                this.ˉ.ˏ(i, f);
            }
            if (this.ˋᐝ != null && this.ˋᐝ.isRunning()) {
                this.ˋᐝ.cancel();
            }
            scrollTo(ॱ(i, f), 0);
            if (z) {
                ˊ(round);
            }
        }
    }

    public void ˊ(@NonNull b bVar) {
        ˏ(bVar, this.ʾ.isEmpty());
    }

    public void ˏ(@NonNull b bVar, boolean z) {
        ˏ(bVar, this.ʾ.size(), z);
    }

    public void ˏ(@NonNull b bVar, int i, boolean z) {
        if (bVar.ˏ != this) {
            throw new IllegalArgumentException("Tab belongs to a different TabLayout.");
        }
        ˋ(bVar, i);
        ॱ(bVar);
        if (z) {
            bVar.ˏ();
        }
    }

    private void ˊ(@NonNull TabItem tabItem) {
        b ˎ = ˎ();
        if (tabItem.ˎ != null) {
            ˎ.ˎ(tabItem.ˎ);
        }
        if (tabItem.ॱ != null) {
            ˎ.ˎ(tabItem.ॱ);
        }
        if (tabItem.ˋ != 0) {
            ˎ.ॱ(tabItem.ˋ);
        }
        if (!TextUtils.isEmpty(tabItem.getContentDescription())) {
            ˎ.ˊ(tabItem.getContentDescription());
        }
        ˊ(ˎ);
    }

    @Deprecated
    public void setOnTabSelectedListener(@Nullable c cVar) {
        if (this.ˎˎ != null) {
            ˊ(this.ˎˎ);
        }
        this.ˎˎ = cVar;
        if (cVar != null) {
            ˎ(cVar);
        }
    }

    public void ˎ(@NonNull c cVar) {
        if (!this.ˍ.contains(cVar)) {
            this.ˍ.add(cVar);
        }
    }

    public void ˊ(@NonNull c cVar) {
        this.ˍ.remove(cVar);
    }

    @NonNull
    public b ˎ() {
        b ˏ = ˏ();
        ˏ.ˏ = this;
        ˏ.ˊ = ˏ(ˏ);
        return ˏ;
    }

    protected b ˏ() {
        b bVar = (b) ʼॱ.ˎ();
        if (bVar == null) {
            return new b();
        }
        return bVar;
    }

    protected boolean ˋ(b bVar) {
        return ʼॱ.ˋ(bVar);
    }

    public int ॱ() {
        return this.ʾ.size();
    }

    @Nullable
    public b ॱ(int i) {
        return (i < 0 || i >= ॱ()) ? null : (b) this.ʾ.get(i);
    }

    public int ˊ() {
        return this.ʽॱ != null ? this.ʽॱ.ॱ() : -1;
    }

    public void ˋ() {
        for (int childCount = this.ˉ.getChildCount() - 1; childCount >= 0; childCount--) {
            ˎ(childCount);
        }
        Iterator it = this.ʾ.iterator();
        while (it.hasNext()) {
            b bVar = (b) it.next();
            it.remove();
            bVar.ᐝ();
            ˋ(bVar);
        }
        this.ʽॱ = null;
    }

    public void setTabMode(int i) {
        if (i != this.ॱˎ) {
            this.ॱˎ = i;
            ॱˊ();
        }
    }

    public void setTabGravity(int i) {
        if (this.ˏॱ != i) {
            this.ˏॱ = i;
            ॱˊ();
        }
    }

    public void setSelectedTabIndicatorGravity(int i) {
        if (this.ʻॱ != i) {
            this.ʻॱ = i;
            ViewCompat.ˎ(this.ˉ);
        }
    }

    public void setTabIndicatorFullWidth(boolean z) {
        this.ॱᐝ = z;
        ViewCompat.ˎ(this.ˉ);
    }

    public void setInlineLabel(boolean z) {
        if (this.ॱˋ != z) {
            this.ॱˋ = z;
            for (int i = 0; i < this.ˉ.getChildCount(); i++) {
                View childAt = this.ˉ.getChildAt(i);
                if (childAt instanceof i) {
                    ((i) childAt).ˎ();
                }
            }
            ॱˊ();
        }
    }

    public void setInlineLabelResource(@BoolRes int i) {
        setInlineLabel(getResources().getBoolean(i));
    }

    public void setUnboundedRipple(boolean z) {
        if (this.ʿ != z) {
            this.ʿ = z;
            for (int i = 0; i < this.ˉ.getChildCount(); i++) {
                View childAt = this.ˉ.getChildAt(i);
                if (childAt instanceof i) {
                    ((i) childAt).ˊ(getContext());
                }
            }
        }
    }

    public void setUnboundedRippleResource(@BoolRes int i) {
        setUnboundedRipple(getResources().getBoolean(i));
    }

    public void setTabTextColors(@Nullable ColorStateList colorStateList) {
        if (this.ॱॱ != colorStateList) {
            this.ॱॱ = colorStateList;
            ʻ();
        }
    }

    @Nullable
    public ColorStateList ॱॱ() {
        return this.ॱॱ;
    }

    public void setTabTextColors(int i, int i2) {
        setTabTextColors(ˊ(i, i2));
    }

    public void setTabIconTint(@Nullable ColorStateList colorStateList) {
        if (this.ʼ != colorStateList) {
            this.ʼ = colorStateList;
            ʻ();
        }
    }

    public void setTabIconTintResource(@ColorRes int i) {
        setTabIconTint(ar.ˊ(getContext(), i));
    }

    public void setTabRippleColor(@Nullable ColorStateList colorStateList) {
        if (this.ʻ != colorStateList) {
            this.ʻ = colorStateList;
            for (int i = 0; i < this.ˉ.getChildCount(); i++) {
                View childAt = this.ˉ.getChildAt(i);
                if (childAt instanceof i) {
                    ((i) childAt).ˊ(getContext());
                }
            }
        }
    }

    public void setTabRippleColorResource(@ColorRes int i) {
        setTabRippleColor(ar.ˊ(getContext(), i));
    }

    public void setSelectedTabIndicator(@Nullable Drawable drawable) {
        if (this.ʽ != drawable) {
            this.ʽ = drawable;
            ViewCompat.ˎ(this.ˉ);
        }
    }

    public void setSelectedTabIndicator(@DrawableRes int i) {
        if (i != 0) {
            setSelectedTabIndicator(ar.ˋ(getContext(), i));
        } else {
            setSelectedTabIndicator(null);
        }
    }

    public void setupWithViewPager(@Nullable ViewPager viewPager) {
        setupWithViewPager(viewPager, true);
    }

    public void setupWithViewPager(@Nullable ViewPager viewPager, boolean z) {
        ˋ(viewPager, z, false);
    }

    private void ˋ(@Nullable ViewPager viewPager, boolean z, boolean z2) {
        if (this.ˈ != null) {
            if (this.ˏˎ != null) {
                this.ˈ.removeOnPageChangeListener(this.ˏˎ);
            }
            if (this.ˎˏ != null) {
                this.ˈ.removeOnAdapterChangeListener(this.ˎˏ);
            }
        }
        if (this.ˋˋ != null) {
            ˊ(this.ˋˋ);
            this.ˋˋ = null;
        }
        if (viewPager != null) {
            this.ˈ = viewPager;
            if (this.ˏˎ == null) {
                this.ˏˎ = new f(this);
            }
            this.ˏˎ.ˏ();
            viewPager.addOnPageChangeListener(this.ˏˎ);
            this.ˋˋ = new j(viewPager);
            ˎ(this.ˋˋ);
            PagerAdapter ˎ = viewPager.getAdapter();
            if (ˎ != null) {
                ˎ(ˎ, z);
            }
            if (this.ˎˏ == null) {
                this.ˎˏ = new a(this);
            }
            this.ˎˏ.ॱ(z);
            viewPager.addOnAdapterChangeListener(this.ˎˏ);
            setScrollPosition(viewPager.getCurrentItem(), 0.0f, true);
        } else {
            this.ˈ = null;
            ˎ(null, false);
        }
        this.ˑ = z2;
    }

    @Deprecated
    public void setTabsFromPagerAdapter(@Nullable PagerAdapter ozVar) {
        ˎ(ozVar, false);
    }

    public boolean shouldDelayChildPressedState() {
        return ʼ() > 0;
    }

    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        if (this.ˈ == null) {
            ViewParent parent = getParent();
            if (parent instanceof ViewPager) {
                ˋ((ViewPager) parent, true, true);
            }
        }
    }

    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        if (this.ˑ) {
            setupWithViewPager(null);
            this.ˑ = false;
        }
    }

    private int ʼ() {
        return Math.max(0, ((this.ˉ.getWidth() - getWidth()) - getPaddingLeft()) - getPaddingRight());
    }

    void ˎ(@Nullable PagerAdapter ozVar, boolean z) {
        if (!(this.ˏˏ == null || this.ͺॱ == null)) {
            this.ˏˏ.unregisterDataSetObserver(this.ͺॱ);
        }
        this.ˏˏ = ozVar;
        if (z && ozVar != null) {
            if (this.ͺॱ == null) {
                this.ͺॱ = new d(this);
            }
            ozVar.registerDataSetObserver(this.ͺॱ);
        }
        ʽ();
    }

    void ʽ() {
        ˋ();
        if (this.ˏˏ != null) {
            int i;
            int ˎ = this.ˏˏ.getCount();
            for (i = 0; i < ˎ; i++) {
                ˏ(ˎ().ˎ(this.ˏˏ.getPageTitle(i)), false);
            }
            if (this.ˈ != null && ˎ > 0) {
                i = this.ˈ.getCurrentItem();
                if (i != ˊ() && i < ॱ()) {
                    ˎ(ॱ(i));
                }
            }
        }
    }

    private void ʻ() {
        int size = this.ʾ.size();
        for (int i = 0; i < size; i++) {
            ((b) this.ʾ.get(i)).ʽ();
        }
    }

    private i ˏ(@NonNull b bVar) {
        i iVar = this.ॱʼ != null ? (i) this.ॱʼ.ˎ() : null;
        if (iVar == null) {
            iVar = new i(this, getContext());
        }
        iVar.ˎ(bVar);
        iVar.setFocusable(true);
        iVar.setMinimumWidth(ˏॱ());
        if (TextUtils.isEmpty(bVar.ॱॱ)) {
            iVar.setContentDescription(bVar.ˎ);
        } else {
            iVar.setContentDescription(bVar.ॱॱ);
        }
        return iVar;
    }

    private void ˋ(b bVar, int i) {
        bVar.ˋ(i);
        this.ʾ.add(i, bVar);
        int size = this.ʾ.size();
        for (int i2 = i + 1; i2 < size; i2++) {
            ((b) this.ʾ.get(i2)).ˋ(i2);
        }
    }

    private void ॱ(b bVar) {
        this.ˉ.addView(bVar.ˊ, bVar.ॱ(), ͺ());
    }

    public void addView(View view) {
        ˏ(view);
    }

    public void addView(View view, int i) {
        ˏ(view);
    }

    public void addView(View view, ViewGroup.LayoutParams layoutParams) {
        ˏ(view);
    }

    public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
        ˏ(view);
    }

    private void ˏ(View view) {
        if (view instanceof TabItem) {
            ˊ((TabItem) view);
            return;
        }
        throw new IllegalArgumentException("Only TabItem instances can be added to TabLayout");
    }

    private LayoutParams ͺ() {
        LayoutParams layoutParams = new LayoutParams(-2, -1);
        ˊ(layoutParams);
        return layoutParams;
    }

    private void ˊ(LayoutParams layoutParams) {
        if (this.ॱˎ == 1 && this.ˏॱ == 0) {
            layoutParams.width = 0;
            layoutParams.weight = 1.0f;
            return;
        }
        layoutParams.width = -2;
        layoutParams.weight = 0.0f;
    }

    @Dimension(unit = 1)
    int ˏ(@Dimension(unit = 0) int i) {
        return Math.round(getResources().getDisplayMetrics().density * ((float) i));
    }

    protected void onDraw(Canvas canvas) {
        for (int i = 0; i < this.ˉ.getChildCount(); i++) {
            View childAt = this.ˉ.getChildAt(i);
            if (childAt instanceof i) {
                ((i) childAt).ˋ(canvas);
            }
        }
        super.onDraw(canvas);
    }

    protected void onMeasure(int i, int i2) {
        int i3 = 1;
        int ˏ = (ˏ(ˊॱ()) + getPaddingTop()) + getPaddingBottom();
        switch (MeasureSpec.getMode(i2)) {
            case Integer.MIN_VALUE:
                i2 = MeasureSpec.makeMeasureSpec(Math.min(ˏ, MeasureSpec.getSize(i2)), 1073741824);
                break;
            case 0:
                i2 = MeasureSpec.makeMeasureSpec(ˏ, 1073741824);
                break;
        }
        ˏ = MeasureSpec.getSize(i);
        if (MeasureSpec.getMode(i) != 0) {
            if (this.ˋˊ > 0) {
                ˏ = this.ˋˊ;
            } else {
                ˏ -= ˏ(56);
            }
            this.ॱˊ = ˏ;
        }
        super.onMeasure(i, i2);
        if (getChildCount() == 1) {
            View childAt = getChildAt(0);
            switch (this.ॱˎ) {
                case 0:
                    if (childAt.getMeasuredWidth() >= getMeasuredWidth()) {
                        ˏ = 0;
                        break;
                    } else {
                        ˏ = 1;
                        break;
                    }
                case 1:
                    if (childAt.getMeasuredWidth() == getMeasuredWidth()) {
                        i3 = 0;
                    }
                    ˏ = i3;
                    break;
                default:
                    ˏ = 0;
                    break;
            }
            if (ˏ != 0) {
                childAt.measure(MeasureSpec.makeMeasureSpec(getMeasuredWidth(), 1073741824), getChildMeasureSpec(i2, getPaddingTop() + getPaddingBottom(), childAt.getLayoutParams().height));
            }
        }
    }

    private void ˎ(int i) {
        i iVar = (i) this.ˉ.getChildAt(i);
        this.ˉ.removeViewAt(i);
        if (iVar != null) {
            iVar.ॱ();
            this.ॱʼ.ˋ(iVar);
        }
        requestLayout();
    }

    private void ˋ(int i) {
        if (i != -1) {
            if (getWindowToken() == null || !ViewCompat.ˊᐝ(this) || this.ˉ.ˏ()) {
                setScrollPosition(i, 0.0f, true);
                return;
            }
            if (getScrollX() != ॱ(i, 0.0f)) {
                ˋॱ();
                this.ˋᐝ.setIntValues(new int[]{r0, r1});
                this.ˋᐝ.start();
            }
            this.ˉ.ॱ(i, this.ᐝॱ);
        }
    }

    private void ˋॱ() {
        if (this.ˋᐝ == null) {
            this.ˋᐝ = new ValueAnimator();
            this.ˋᐝ.setInterpolator(aqv.ॱ);
            this.ˋᐝ.setDuration((long) this.ᐝॱ);
            this.ˋᐝ.addUpdateListener(new AnimatorUpdateListener(this) {
                final /* synthetic */ TabLayout ॱ;

                {
                    this.ॱ = r1;
                }

                public void onAnimationUpdate(ValueAnimator valueAnimator) {
                    this.ॱ.scrollTo(((Integer) valueAnimator.getAnimatedValue()).intValue(), 0);
                }
            });
        }
    }

    private void ˊ(int i) {
        int childCount = this.ˉ.getChildCount();
        if (i < childCount) {
            for (int i2 = 0; i2 < childCount; i2++) {
                boolean z;
                View childAt = this.ˉ.getChildAt(i2);
                if (i2 == i) {
                    z = true;
                } else {
                    z = false;
                }
                childAt.setSelected(z);
                if (i2 == i) {
                    z = true;
                } else {
                    z = false;
                }
                childAt.setActivated(z);
            }
        }
    }

    void ˎ(b bVar) {
        ˎ(bVar, true);
    }

    void ˎ(b bVar, boolean z) {
        b bVar2 = this.ʽॱ;
        if (bVar2 != bVar) {
            int ॱ = bVar != null ? bVar.ॱ() : -1;
            if (z) {
                if ((bVar2 == null || bVar2.ॱ() == -1) && ॱ != -1) {
                    setScrollPosition(ॱ, 0.0f, true);
                } else {
                    ˋ(ॱ);
                }
                if (ॱ != -1) {
                    ˊ(ॱ);
                }
            }
            this.ʽॱ = bVar;
            if (bVar2 != null) {
                ʼ(bVar2);
            }
            if (bVar != null) {
                ॱॱ(bVar);
            }
        } else if (bVar2 != null) {
            ʻ(bVar);
            ˋ(bVar.ॱ());
        }
    }

    private void ॱॱ(@NonNull b bVar) {
        for (int size = this.ˍ.size() - 1; size >= 0; size--) {
            ((c) this.ˍ.get(size)).ˊ(bVar);
        }
    }

    private void ʼ(@NonNull b bVar) {
        for (int size = this.ˍ.size() - 1; size >= 0; size--) {
            ((c) this.ˍ.get(size)).ˎ(bVar);
        }
    }

    private void ʻ(@NonNull b bVar) {
        for (int size = this.ˍ.size() - 1; size >= 0; size--) {
            ((c) this.ˍ.get(size)).ˏ(bVar);
        }
    }

    private int ॱ(int i, float f) {
        int i2 = 0;
        if (this.ॱˎ != 0) {
            return 0;
        }
        int width;
        View childAt = this.ˉ.getChildAt(i);
        View childAt2 = i + 1 < this.ˉ.getChildCount() ? this.ˉ.getChildAt(i + 1) : null;
        if (childAt != null) {
            width = childAt.getWidth();
        } else {
            width = 0;
        }
        if (childAt2 != null) {
            i2 = childAt2.getWidth();
        }
        int left = (childAt.getLeft() + (width / 2)) - (getWidth() / 2);
        i2 = (int) ((((float) (i2 + width)) * 0.5f) * f);
        return ViewCompat.ʼ(this) == 0 ? i2 + left : left - i2;
    }

    private void ॱˊ() {
        int max;
        if (this.ॱˎ == 0) {
            max = Math.max(0, this.ˌ - this.ˊ);
        } else {
            max = 0;
        }
        ViewCompat.ˏ(this.ˉ, max, 0, 0, 0);
        switch (this.ॱˎ) {
            case 0:
                this.ˉ.setGravity(8388611);
                break;
            case 1:
                this.ˉ.setGravity(1);
                break;
        }
        ˏ(true);
    }

    void ˏ(boolean z) {
        for (int i = 0; i < this.ˉ.getChildCount(); i++) {
            View childAt = this.ˉ.getChildAt(i);
            childAt.setMinimumWidth(ˏॱ());
            ˊ((LayoutParams) childAt.getLayoutParams());
            if (z) {
                childAt.requestLayout();
            }
        }
    }

    private static ColorStateList ˊ(int i, int i2) {
        r0 = new int[2][];
        int[] iArr = new int[]{SELECTED_STATE_SET, i2};
        r0[1] = EMPTY_STATE_SET;
        iArr[1] = i;
        return new ColorStateList(r0, iArr);
    }

    @Dimension(unit = 0)
    private int ˊॱ() {
        Object obj;
        int size = this.ʾ.size();
        for (int i = 0; i < size; i++) {
            b bVar = (b) this.ʾ.get(i);
            if (bVar != null && bVar.ˋ() != null && !TextUtils.isEmpty(bVar.ˊ())) {
                obj = 1;
                break;
            }
        }
        obj = null;
        if (obj == null || this.ॱˋ) {
            return 48;
        }
        return 72;
    }

    private int ˏॱ() {
        if (this.ˊᐝ != -1) {
            return this.ˊᐝ;
        }
        return this.ॱˎ == 0 ? this.ˊˊ : 0;
    }

    public FrameLayout.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
        return generateDefaultLayoutParams();
    }

    int ᐝ() {
        return this.ॱˊ;
    }
}
